<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8" %>
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700" rel="stylesheet">
    <link rel="stylesheet" href="css/bootstrap.min.css"/>
    <link rel="stylesheet" href="css/fontawesome.css">
    <link rel="stylesheet" href="css/templatemo-style.css">
    <link rel="stylesheet" href="css/owl.css">

    <%--<link rel="stylesheet" href="css/reset.css">
    <link rel="stylesheet" href="css/car.css">--%>

    <script type="text/javascript">
        function showOrder(orderId) {
            location.href = "${pageContext.request.contextPath}/getOrderDetail?oid=" + orderId;
        }

        function deleteOrder(orderId) {
            location.href = "${pageContext.request.contextPath}/userDeleteOrder?oid=" + orderId;
        }

        function changeStatus(orderId) {
            location.href = "${pageContext.request.contextPath}/changeStatus?oid=" + orderId;
        }
    </script>
</head>
<body class="is-preload">

<!-- Wrapper -->
<div id="wrapper" class="">

    <!-- Main -->
    <div id="main">
        <div class="inner">

            <!-- Header -->
            <header id="header">
                <div class="logo">
                    <!-- <a href="index.html">Ramayana</a> -->
                </div>
            </header>

            <!-- Banner -->
            <section class="main-banner">
                <div class="container-fluid">
                    <div class="row">
                        <div class="toptitle">
                            <span class="line"></span>
                            <p style="display: inline-block; font-size: 20px;">我的订单列表&nbsp;&nbsp;
                                <small>温馨提示：<em>${loginUser.username}</em>有<font
                                        color="red">${orderList.size()}</font>个订单</small></p>
                        </div>
                        <div class="row" style="margin-top: 40px; font-size: 16px;">
                            <table id="tb_list"
                                   class="table table-striped table-hover table-bordered table-condensed">
                                <tr>
                                    <th>序号</th>
                                    <th>订单编号</th>
                                    <th>总金额</th>
                                    <th>订单状态</th>
                                    <th>订单时间</th>
                                    <th>收货地址</th>
                                    <th>操作</th>
                                </tr>
                                <c:forEach items="${orderList}" var="order" varStatus="i">
                                    <tr>
                                        <th>${i.count}</th>
                                        <th>${order.id}</th>
                                        <th>${order.money}</th>
                                        <th>
                                            <font color="red">
                                                <c:if test="${order.flag eq 1 }">
                                                    未支付
                                                </c:if>
                                                <c:if test="${order.flag eq 2 }">
                                                    已支付,待发货
                                                </c:if>
                                                <c:if test="${order.flag eq 3 }">
                                                    已发货,待收货
                                                </c:if>
                                                <c:if test="${order.flag eq 4 }">
                                                    已收货，未评分
                                                </c:if>
                                                <c:if test="${order.flag eq 5 }">
                                                    订单完成
                                                </c:if>
                                            </font>
                                        </th>
                                        <th>${order.createtime}</th>
                                        <th>${order.address}</th>
                                        <th>
                                            <button type="button" class="btn btn-danger btn-sm"
                                                    onclick="showOrder('${order.id}')">
                                                订单详情
                                            </button>
                                            <button type="button" class="btn btn-danger btn-sm"
                                                    onclick="deleteOrder('${order.id}')">
                                                删除订单
                                            </button>
                                            <c:if test="${order.flag eq 3 }">
                                                <button type="button" class="btn btn-warning btn-sm"
                                                        onclick="changeStatus('${order.id}')">确认收货
                                                </button>
                                            </c:if>
                                        </th>
                                    </tr>
                                </c:forEach>
                            </table>
                        </div>
                    </div>
                </div>
            </section>


        </div>
    </div>

    <!-- Sidebar -->
    <div id="sidebar">

        <div class="inner">


            <!-- Menu -->
            <nav id="menu">
                <ul>
                    <p style="font-size:18px">个人中心</p>
                    <li><a href="myList_info.jsp">我的个人中心</a></li>
                    <li><a href="">消息通知</a></li>
                    <li><a href="userAddressShow">收货地址</a></li>
                    <li><a href="https://www.google.com">优惠券</a></li>
                    <p style="font-size:18px">订单中心</p>
                    <li><a href="getOrderList">我的订单</a></li>
                    <li><a href="">意外保</a></li>
                    <li><a href="">团购订单</a></li>
                    <li><a href="">评价晒单</a></li>
                </ul>
            </nav>


        </div>
    </div>

</div>

</body>
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.bundle.min.js"></script>

<script src="js/browser.min.js"></script>
<script src="js/breakpoints.min.js"></script>
<script src="js/transition.js"></script>
<script src="js/owl-carousel.js"></script>
<script src="js/custom.js"></script>
</html>